<?php

//TODO Renommer les id et class des champs pour le css pour avoir quelques chose de plus propre
function formContact($action){
  Doo::loadHelper('DooForm');
  $form = new DooForm(array(
         'method' => 'post',
         'action' => $action,
       'attributes' => array('id' => 'main-form-contact'),
         'elements' => array(
         'lastname' => array('text', array(
             'required' => true,
             'label' => "Nom : <span class='red-required'>*</span>",
         'field-wrapper' => 'div',
         'attributes' => array('class' => 'required', 'type_validate' => 'str_max32'),
             'validators' => array(
                 array('required','Field required'),
                 array('maxlength',32,'This is too long')
             )
        )),
        'firstname' => array('text', array(
             'required' => true,
             'label' => "Prénom : <span class='red-required'>*</span>",
         'field-wrapper' => 'div',
         'attributes' => array('class' => 'required', 'type_validate' => 'str_max32'),
             'validators' => array(
                 array('required','Field required'),
                 array('maxlength',32,'This is too long')
             )
        )),
        'phone' => array('text', array(
           'required' => false,
             'label' => "Téléphone : <span class='green-optional'>*</span>",
         'field-wrapper' => 'div',
         'attributes' => array('type_validate' => 'str_max32'),
             'validators' => array(
                array('maxlength',32,'This is too long')
             )
        )),
        'mail' => array('text', array(
           'required' => false,
             'label' => "Email : <span class='green-optional'>*</span>",
         'field-wrapper' => 'div',
         'attributes' => array('type_validate' => 'email'),
             'validators' => array(
                 array('email')
             )
        )),
        'message' => array('textarea', array(
             'required' => true,
             'label' => "Message : <span class='red-required'>*</span>",
         'field-wrapper' => 'div',
         'attributes' => array('class' => 'required'),
             'validators' => array(
                 array('required','Field required')
             )
        )),
        'submit' => array('submit', array(
            'label' => "",
          'attributes' => array('id' => 'contact-submit'),
            'field-wrapper' => 'div'
        ))
     ),
    ));
    return $form;
}


?>